#ifndef _DATA_TYPE_DEF_F28_
#define _DATA_TYPE_DEF_F28_

#define _TRUE     1
#define _FALSE    (!_TRUE)

#define _ENABLE   _TRUE
#define _DISABLE  _FALSE

#define _VALID    _TRUE
#define _INVALID  _FALSE

#define _ON       _TRUE
#define _OFF      _FALSE

#define _ERROR    1
#define _NO_ERR   0

#define _LOCKED   1
#define _UNLOCK   0

#define _SUCCESSFUL  1
#define _FAILING     0

#define _NULL     0

typedef unsigned char      bit;

typedef char               int8;
typedef int                int16;
typedef long               int32;
typedef long long          int64;
typedef unsigned char      uint8;
typedef unsigned int       uint16;
typedef unsigned long      uint32;
typedef unsigned long long uint64;

typedef uint16       Uint16;
typedef uint32       Uint32;
typedef uint64       Uint64;
typedef float        float32;
typedef long double  float64;


typedef unsigned char* pbit;
typedef char*  pint8;
typedef int* pint16;
typedef long*   pint32;
typedef unsigned char*  puint8;
typedef unsigned int* puint16;
typedef unsigned long*   puint32;
typedef unsigned long long* puint64;
typedef long long* pint64;

typedef struct {
	int16 Re;
	int16 Im;
} COMPLEX_Q16, *P_COMPLEX_Q16;

typedef struct {
	int32 Re;
	int32 Im;
} COMPLEX_Q32, *P_COMPLEX_Q32;

typedef struct {
	double Re;
	double Im;
}COMPLEX_DB, *P_COMPLEX_DB;

typedef struct
{
	uint16 nByteL:8;
	uint16 nByteH:8;
}BYTE_CELL, *P_BYTE_CELL;

typedef struct
{
	uint16 nField_0:4;
	uint16 nField_1:4;
	uint16 nField_2:4;
	uint16 nField_3:4;
}BIT4_CELL, *P_BIT4_CELL;



typedef struct
{
	pint16 pBuf;
	int32 nDeep;
	int32 nWp, nRp;
}BUFFER_CTRL_int16, *P_BUFFER_CTRL_int16;

typedef struct
{
	pint32 pBuf;
	int32 nDeep;
	int32 nWp, nRp;
}BUFFER_CTRL_int32, *P_BUFFER_CTRL_int32;

#define STATIC_BUFFER(nDeep, dType) \
	struct \
	{ \
		BUFFER_CTRL_##dType BufCtrl; \
		dType Buf[nDeep]; \
	}

#define CREATE_STATIC_BUFFER(BufName, nDeep, dType) \
	STATIC_BUFFER(nDeep, dType) BufName = { \
		{BufName##.Buf, \
		nDeep, \
		0, 0}, \
		{0} \
	}




#define PI 3.1415926535897932384626433832795

#define MAX(a,b) ((a)>(b) ? (a) : (b))
#define MIN(a,b) ((a)>(b) ? (b) : (a))
#define ABS(a)   ((a)>0 ? (a) : -(a))
#define SIGN(a)  ((a)>0 ? (1) : (-1))
#define EXTU32(a, nL, nR)   ((((uint32)(a))<<(nL))>>(nR))

#define BIT2BYTE_CEIL(x_bit_num)   ( (int32)((x_bit_num + 7) / 8) )
#define BIT2_32BIT_WORD_CEIL(x_bit_num)   ( (int32)((x_bit_num + 31) / 32) )

#define CEIL_X_TO_MULTI_OF_N(x, N)  ( ( (int32)(((x)+(N-1)) / (N) ) ) * (N) )

#define SIZE_OF_STRUCT(s_type, s_member) \
	( (int32)(sizeof( ((s_type*)0)->s_member )) )
#define OFFSET_OF_STRUCT(s_type, s_member) \
	( (int32)(&(((s_type*)0)->s_member)) )

#define SCIA_WRITE_BYTE(b) printf("current byte is=%s",b)




#endif // _DATA_TYPE_DEF_F28_
